package com.itheima.demo;

public class Demo01 {

    public static void main(String[] args) {

        int[] arr = {12 , 34 , 56 , 11 , 10 , 9} ;

        printArr(arr);



    }
    public static void printArr(int[] arr){

        sortAdd(arr);

        for(int x = 0 ; x < arr.length ; x++) {
            System.out.print(arr[x] + " ");
        }

    }


    public static void sortAdd(int[] arr){

        for (int a = 0; a < arr.length-1; a++) {

            for (int i = 0; i < arr.length - 1 - a; i++) {

                if (arr[i] > arr[i + 1]) {

                    int temp = arr[i];
                    arr[i] = arr[i + 1];
                    arr[i + 1] = temp;

                }
            }

        }

    }
}
